<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>编辑</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all"/>
    <script src="/layuiadmin/layui/layui.js"></script>
</head>
<body style="background-color:#fff">

<div class="layui-card">
    <div class="layui-card-body">
        <form class="layui-form" action="" class="layui-form layui-form-pane" lay-filter="layui-form-pane" id="sbumitForm">
            <div class="layui-row layui-col-space10 layui-form-item">
                <div class="layui-col-lg6">
                    <label class="layui-form-label">用户ID</label>
                    <div class="layui-input-block">
                        <input type="text" value="{$model->uid}" class="layui-input"  autocomplete="off" readonly="true">
                    </div>
                </div>
            </div>

            <div class="layui-row layui-col-space10 layui-form-item">
                <div class="layui-col-lg6">
                    <label class="layui-form-label">奖品名称</label>
                    <div class="layui-input-block">
                        <input type="text" value="{$model->name}" class="layui-input"  autocomplete="off" readonly="true">
                    </div>
                </div>
            </div>

            <div class="layui-row layui-col-space10 layui-form-item">
                <div class="layui-col-lg6">
                    <label class="layui-form-label">奖品数量</label>
                    <div class="layui-input-block">
                        <input type="text" value="{$model->name}" class="layui-input" autocomplete="off" readonly="true">
                    </div>
                </div>
            </div>

            <div class="layui-row layui-col-space10 layui-form-item" style="margin-bottom: 0px">
                <div class="layui-col-lg6" style="padding-bottom: 0px">
                    <label class="layui-form-label">奖品状态</label>
                    <div class="layui-input-block">
                        <input type="text"  value="<?php if($model->give_status){ echo '已发放';}else{echo '待发放';} ?>" class="layui-input" autocomplete="off" readonly="true">
                    </div>
                </div>
            </div>
            <div class="layui-row layui-col-space10 layui-form-item" style="margin-top: 3px;margin-bottom:5px;padding: 0px">
                <div class="layui-col-lg6" style="padding: 0px">
                    <label class="layui-form-label">

                    </label>
                    <div class="layui-input-block" style="padding-left: 5px">
                        <span class="layui-btn" style="height: 25px;line-height:25px;background-color: #1E9FFF;width: 80px" id="budan">补&nbsp;&nbsp;单</span>
                    </div>
                </div>
            </div>

            <div class="layui-row layui-col-space10 layui-form-item" id="shuliang">
            </div>

            <div class="layui-row layui-col-space10 layui-form-item" id="beizhu">

            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <span class="layui-btn"  lay-submit lay-filter="formSubmit" style="width: 100%">确认补单</span>
                </div>
            </div>
        </form>
    </div>
</div>
<script src="/assets/cos-js-sdk-v5/cos-js-sdk-v5.min.js"></script>
<script>

    layui.use(['form'], function () {
        var $ = layui.jquery, form = layui.form, layer = layui.layer;

        form.on('submit(formSubmit)', function(data){
            layer.confirm('确认要进行补单吗？', {icon: 6}, function () {
                $.ajax({
                    type: "POST", //请求方式
                    url: '/admin/rotary_table/budan?id={$model->id}', //请求地址
                    dataType: "json", //返回的数据类型
                    data: $("#sbumitForm").serialize(), //数据
                    //请求成功
                    success: function (data) {
                        if (data.code == 0) {
                            layer.msg(data.msg, {icon: 1, time: 2000}, function () {
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(index);
                                window.parent.location.reload();
                            });
                        } else {
                            layer.msg(data.msg, {icon: 2, time: 5000});
                        }
                    },
                    //请求失败
                    error: function (e) {
                        if (e.responseJSON.msg) {
                            layer.msg(e.responseJSON.msg, {icon: 2});
                        }
                    }
                });
            });
        });

        $("#budan").click(function () {
            $("#shuliang").empty();
            $("#beizhu").empty();

            $("#shuliang").html('<div class="layui-col-lg6">\n' +
                '                    <label class="layui-form-label">数量</label>\n' +
                '                    <div class="layui-input-block">\n' +
                '                        <input type="text" name="lott_num" value="" class="layui-input" lay-verify="required" autocomplete="off">\n' +
                '                    </div>\n' +
                '                </div>');
            $("#beizhu").html('<div class="layui-col-lg6">\n' +
                '                    <label class="layui-form-label">备注</label>\n' +
                '                    <div class="layui-input-block">\n' +
                '                        <input type="text" name="express_no" value="" class="layui-input" autocomplete="off">\n' +
                '                    </div>\n' +
                '                </div>');

            form.render();

        });
    });

</script>
</body>

</html>